package com.test.mono;

import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Mono;

/**
 * TODO
 *
 * @Description
 * @Author lingmin
 * @Date 2025/4/14 18:19
 **/
@Slf4j
public class MonoBasicExample {
    public static void main(String[] args) {
        // 创建 Mono
        Mono<String> mono = Mono.just("Hello, Reactor!");

        // 订阅并处理
        mono.subscribe(
                value -> log.info("接收到数据: " + value), // onNext
                error -> log.info("发生错误: " + error),   // onError
                () -> log.info("处理完成")                // onComplete
        );
    }
}